package pl.ericpol.kernel.pool;

import java.util.List;

import pl.ericpol.environment.devices.Device;

public class DevicePool {
	
	private List<Device> devices;

	public DevicePool(List<Device> devices) {
		this.devices = devices;
	}

	public List<Device> getDevices() {
		return devices;
	}

	public void setDevices(List<Device> devices) {
		this.devices = devices;
	}
	
	public Device getDeviceById(int id) {
		Device resultDevice = null;
		for (Device device : devices) {
			if (device.getId()==id) {
				resultDevice = device;
				break;
			}				
		}
		return resultDevice;
	}
	
	public void addDevice(Device device) {
		devices.add(device);
	}

}
